package org.example.mapper;

import org.apache.ibatis.annotations.*;

import java.time.LocalDateTime;

@Mapper
public interface Wdzjmapper {

    /**
     * 查询
     * @param id
     * @return
     */
    @Select("select wdzj_time from wdzj where product_id=#{id} and username=#{username}")
    Object cx(int id,String username);

    /**
     * 新增
     *
     * @param id
     * @param time
     * @param username
     */
    @Insert("INSERT INTO wdzj (product_id, wdzj_time,username)\n" +
            "VALUES (#{id},#{time},#{username});")
    void xz(int id, LocalDateTime time, String username);


    /**
     * 修改
     *
     * @param id
     * @param time
     * @param username
     */
    @Update("UPDATE wdzj\n" +
            "SET wdzj_time=#{time}\n" +
            "WHERE product_id = #{id} and username=#{username};")
    void xg(int id, LocalDateTime time, String username);

    /**
     * 删除
     * @param id
     * @param username
     */
    @Delete("delete from wdzj where product_id=#{id} and username=#{username}")
    void sc(int id, String username);

    @Delete("delete from wdzj where username=#{username}")
    void scqb(String username);

    /**
     * 批量删除
     * @param id
     */
    @Delete("delete from wdzj where product_id=#{id} ")
    void scpl(int id);
}
